using System;
using System.Text.RegularExpressions;
using Xunit;
using YTS.Tools;

namespace LanguageLearnTestCase.String
{
    public class TestExceptionOverride
    {
        [Fact]
        public void OverrideSet()
        {
            try
            {
                ExeFunction();
            }
            catch (Exception ex)
            {
                string StackTrace = ex.StackTrace;
                string Message = ex.Message + ex.InnerException.Message;
                string str = ex.ToString();
                Assert.Equal("第二次异常第一次异常", Message);
            }
        }

        private void ExeFunction()
        {
            try
            {
                throw new Exception("第一次异常");
            }
            catch (Exception ex)
            {

                throw new Exception("第二次异常", ex);
            }
        }
    }
}
